<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
<script src="js/cookie_util.js"></script>
<script type="text/javascript">
    	var user_id=getCookie("userId");
		console.log(user_id);
    	if(user_id!=null){//用户ID存在			
				function changepwd(){
					var mpass=$("#mpass").val();
					var newpass=$("#newpass").val();
					$.ajax({
						url:"user/changepwd.do",
						type:"post",
						data:{"user_id":user_id,"mpass":mpass,"newpass":newpass},
						dataType:"json",
						success:function(rs){
							var status=rs.status;
							console.log(status);
							if(status=="0"){
								alert(rs.msg);
								window.location.href="personalinfo.html";
							}else{
								alert(rs.msg);
							}
						},
						error:function(){
							alert("密码修改成功");
							window.location.href="personalinfo.html";
						}
					})

				};
		}else{//用户ID不存在
			top.location.href="login.html";
		}
    </script>  
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-key"></span> 修改密码</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="">
      <div class="form-group">
        <div class="label">
          <label for="sitename">原始密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" id="mpass" name="mpass" size="50" placeholder="请输入原始密码"/>       
        </div>
      </div>      
      <div class="form-group">
        <div class="label">
          <label for="sitename">新密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" id="newpass" name="newpass" size="50" placeholder="请输入新密码"  />         
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button onclick="changepwd()"  class="button bg-main icon-check-square-o" type="submit"> 提交</button>   
        </div>
      </div>      
    </form>
  </div>
</div>
</body></html>